﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UtilZ.Dotnet.Ex.Model;

namespace ConAppCore.Test
{
    internal class TestValueRangeManager
    {
        public static void Test()
        {
            //ValueRangeManager
            //Test1();
            Test2();
        }

        private static void Test2()
        {
            string rangeStr = "36.5-78-i|65-85-o|125.68-668";
            var ret1 = NumberValueRangeItem<double>.Parse(rangeStr);

            rangeStr = "36-78-i|65-85-o|132-243|125.68-668";
            var ret2 = NumberValueRangeItem<int>.Parse(rangeStr);
        }

        private static void Test1()
        {
            var items = new NumberValueRangeItem<byte>[]
            {
                new NumberValueRangeItem<byte>(1, 11, ValueRangeType.In),
                new NumberValueRangeItem<byte>(255, 255, ValueRangeType.In)
            };
            var range = new NumberValueRange<byte>("DFMethod", items);

            object value = (byte)6;
            //range.Validate(value, null, null);


            var range2 = new NumberValueRange<int>("FNumber", new NumberValueRangeItem<int>[]
            {
                new NumberValueRangeItem<int>(0, 20, ValueRangeType.Out)
            });
            range2.Validate(20, null, null);
        }
    }
}
